use crate::helpers::Bot;
use anyhow::{Context, Result};
use teloxide::prelude::*;
use db::{ /*models::MatrixOrTelegramId,*/ Db};

pub async fn count_unread_time(bot: Bot, m: Message, db: Db) -> Result<()> {
    let user_id = m.from().context("NoneError")?.id;
    // let user = MatrixOrTelegramId::TelegramId { id: user_id, username: None };
    // let user = db.get_user_id(&user).await?;
    let unread_time = db.count_unread_time_db_tg(&user_id).await?;
    bot.send_message(user_id, format!("Unread time: {}", unread_time))
        .await?;
    Ok(())
}